<style>
    .layui-form-switch {
        position: relative;
        height: 22px;
        line-height: 22px;
        min-width: 35px;
        padding: 0 5px;
        margin-top: 8px;
        border: 1px solid #d2d2d2;
        border-radius: 20px;
        cursor: pointer;
        background-color: #fff;
        -webkit-transition: .1s linear;
        transition: .1s linear;
        width: 60px;

    }
    .layui-form-onswitch {
        border-color: #5FB878;
        background-color: #5FB878;
        width: 50px;
    }
    .layui-form-onswitch i {
        left: 100%;
        margin-left: -21px;
        background-color: #fff;
    }
    .default,.blue{
        box-shadow: none;
        border: 1px solid;
        text-decoration: none;
        color: #fff;
        display: inline-block;
        padding: 6px 12px;
        margin-bottom: 0;
        font-size: 14px;
        font-weight: 400;
        line-height: 1.42857143;
        text-align: center;
        white-space: nowrap;
        vertical-align: middle;
        -ms-touch-action: manipulation;
        touch-action: manipulation;
        cursor: pointer;
    }
    .blue{
        background: #3c8dbc;
        color: #fff;
    }
</style>
<form action="{:url()}" method="post" class="form_single">
    <div class="box">
      <div class="box-body">
        <div class="row">
          <div class="col-md-6">
            <div class="form-group">
              <label>平台名称</label>
              <span class="">（平台名称）</span>
              <input class="form-control" name="name" placeholder="请输入平台名称"  maxlength="33"   value="{$info['name']|default=''}" type="text">
            </div>
          </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label>国家</label>
                    <span class="">（国家）</span>
                    <input class="form-control" name="country" placeholder="排名" value="{$info['country']|default=''}" type="text">
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label>排名</label>
                    <span class="">（排名）</span>
                    <input class="form-control" name="ranking" placeholder="排名" value="{$info['ranking']|default=''}" type="text">
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label></label>
                    <span class="">（平台币）</span>
                    <input class="form-control" name="symbol" placeholder="平台币" value="{$info['symbol']|default=''}" type="text">
                </div>
            </div>
            <div class="col-md-6">
                <label class="layui-form-label">标签</label>
                <div>

                    {volist name='tags' id='vo'}
                    <button type="button"  data-id="{$vo.id}" { {if condition=" isset($info)   &&  in_array($vo['id'],$info['tags_array']) eq true "} class="blue" {else/}class="default" {/if} >{$vo['name']}</button>
                    {/volist}

                </div>
                <input type="hidden" name="tags"  value="{$info['tags']|default=''}"/>
            </div>




            <div class="col-md-6">
                <div class="form-group">
                    <label>平台图标（165*128）</label>
                    <span class="">（请上传平台图标）</span>
                    <br/>
                    {assign name="cover_id" value="$info.cover_id|default='0'" /}
                    {:widget('file/index', ['name' => 'cover_id', 'value' => $cover_id, 'type' => 'img'])}
                </div>
            </div>
            <div class="col-md-12">
                <div class="form-group">
                    <label>基本信息</label>
                    <textarea class="form-control" name="content" maxlength="1000" onchange="this.value=this.value.substring(0, 1000)" onkeydown="this.value=this.value.substring(0, 1000)" onkeyup="this.value=this.value.substring(0, 1000)"    rows="8" placeholder="请输入帖子内容">{$info['content']|default=''}</textarea>

                </div>
            </div>


          </div>



      </div>


        
      <div class="box-footer">
          
        <input type="hidden" name="id" value="{$info['id']|default='0'}"/>
        
        {include file="layout/edit_btn_group"/}
        
      </div>
        
      </div>
      </div>
</form>

<script>
    $("body").on('click','.default',function () {

        $(this).removeClass('default');
        $(this).addClass('blue');
        var len= $('.blue').length;
        var str=',';
        for (var i=0; i<len;i++){
            str+=$('.blue').eq(i).attr('data-id')+',';
        }
        $("[name='tags']").val(str);

    })

    $("body").on('click','.blue',function () {
        $(this).removeClass('blue');
        $(this).addClass('default');
        var len= $('.blue').length;
        var str=',';
        for (var i=0; i<len;i++){
            str+=$('.blue').eq(i).attr('data-id')+',';
        }
        $("[name='tags']").val(str);

    })

    $('.onkey').click(function () {
        $(this).hide();
        $(this).next().show();
        $("input[name='"+$(this).attr('data-code')+"']").val(1);
    })
    $('.offkey').click(function () {
        $(this).hide();
        $(this).prev().show();
        $("input[name='"+$(this).attr('data-code')+"']").val(2);

    })




</script>